<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <link type="text/css" href="/static/public/css/font.css" rel="stylesheet"/>
    <link type="text/css" href="/static/public/css/main.css" rel="stylesheet"/>
    <!-- TopJUI框架样式 -->
    <!--<link type="text/css" href="/topjui/themes/default/topjui.core.min.css" rel="stylesheet">
    <link type="text/css" href="/topjui/themes/default/topjui.blue.css" rel="stylesheet" id="dynamicTheme"/>-->
    <!-- FontAwesome字体图标 -->
    <link type="text/css" href="/static/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- layui框架样式 -->
    <link type="text/css" href="/static/plugins/layui/css/layui.css" rel="stylesheet"/>
    <!-- jQuery相关引用 -->
    <script type="text/javascript" src="/static/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/static/plugins/jquery/jquery.cookie.js"></script>
    <!-- TopJUI框架配置 -->
    <script type="text/javascript" src="/static/public/js/topjui.config.js"></script>
    <!-- TopJUI框架核心-->
    <script type="text/javascript" src="/topjui/js/topjui.core.min.js"></script>
    <!-- TopJUI中文支持 -->
    <script type="text/javascript" src="/topjui/js/locale/topjui.lang.zh_CN.js"></script>
    <!-- layui框架js -->
    <script src="/static/plugins/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=lqVkw7DAWGt8CA9NAzxGWrQq"></script>
    <style>
        body {
            margin: 10px;
        }

        blockquote p {
            padding: 5px;
        }

        .layui-table {
            margin-top: 0 !important;
        }

        .layui-elem-quote {
            margin-bottom: 0 !important;
        }

        .layui-table {
            margin-top: 0;
            border-left: 5px solid #e2e2e2 !important;
        }

        .title .icon-new1 {
            margin-left: 10px;
            color: #f00;
        }
        html,body,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
        /*地图标题*/
        .BMap_bubble_title {
            color:white;
            font-size:13px;
            font-weight:bold;
            text-align:left;
            padding-left:5px;
            padding-top:5px;
            border-bottom:1px solid gray;
            background-color:#0066b3;
        }
        /* 消息内容 */
        .BMap_bubble_content {
            background-color:white;
            padding-left:5px;
            padding-top:5px;
            padding-bottom:10px;
        }
        /* 内容 */
        .BMap_pop div:nth-child(9) {
            top:35px !important;
            border-radius:7px;
        }
        /* 左上角删除按键 */
        .BMap_pop img {
            top:46px !important;
            left:250px !important;
        }
        .BMap_top {
            display:none;
        }
        .BMap_bottom {
            display:none;
        }
        .BMap_center {
            display:none;
        }
        /* 隐藏边角 */
        .BMap_pop div:nth-child(1) div {
            display:none;
        }
        .BMap_pop div:nth-child(5) {
            display:none;
        }
        .BMap_pop div:nth-child(3) {
            display:none;
        }
        .BMap_pop div:nth-child(7) {
            display:none;
        }

        ul#navv {
            list-style-type: none;
            padding: 0;
            margin: 0;
        }
        #navv li.a {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/a16.png") top left no-repeat;
            text-decoration: none;
        }
        #navv li.b {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/b16.png") top left no-repeat;
            text-decoration: none;
        }
        #navv li.c {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/c16.png") top left no-repeat;
            text-decoration: none;
        }
        #navv li.d {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/d16.png") top left no-repeat;
            text-decoration: none;
        }
        #navv li.e {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/e16.png") top left no-repeat;
            text-decoration: none;
        }
        #navv li.f {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/f16.png") top left no-repeat;
            text-decoration: none;
        }

        ul#czd {
            list-style-type: none;
            padding: 0;
            margin: 0;
        }
        #czd li.a {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/a16.png") top left no-repeat;
            text-decoration: none;
        }
        #czd li.b {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/b16.png") top left no-repeat;
            text-decoration: none;
        }
        #czd li.c {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/c16.png") top left no-repeat;
            text-decoration: none;
        }
        #czd li.d {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/d16.png") top left no-repeat;
            text-decoration: none;
        }
        #czd li.e {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/e16.png") top left no-repeat;
            text-decoration: none;
        }
        #czd li.f {
            display: block;
            width: 220px;
            padding-left: 20px;
            margin-top:10px ;
            font: bold 80% Arial, Helvetica, sans-serif;
            color: #271313;
            background: url("/img/map/f16.png") top left no-repeat;
            text-decoration: none;
        }
        .anchorBL {
            display: none;
        }

    </style>
</head>

<body>

    <div id="allmap"></div>


</body>
</html>
<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");    // 创建Map实例

    map.centerAndZoom("泰州", 11);  // 初始化地图,设置中心点坐标和地图级别
    //添加地图类型控件
    map.addControl(new BMap.MapTypeControl({
        mapTypes:[
            BMAP_NORMAL_MAP,
            BMAP_HYBRID_MAP
        ]}));
//    map.setMapStyle({
//        style:"light"
//    });
    map.setMapStyle({
        styleJson:[

                {
                    "featureType": "land",
                    "elementType": "geometry",
                    "stylers": {
                        "color": "#e7f4f8ff"
                    }
                },
                {
                    "featureType": "green",
                    "elementType": "all",
                    "stylers": {
                        "color": "#d9ead3ff"
                    }
                },
                {
                    "featureType": "highway",
                    "elementType": "geometry.fill",
                    "stylers": {
                        "color": "#ccccccff"
                    }
                },
                {
                    "featureType": "highway",
                    "elementType": "geometry.stroke",
                    "stylers": {
                        "color": "#999999ff"
                    }
                },
                {
                    "featureType": "arterial",
                    "elementType": "geometry.fill",
                    "stylers": {
                        "color": "#ccccccff"
                    }
                },
                {
                    "featureType": "arterial",
                    "elementType": "geometry.stroke",
                    "stylers": {
                        "color": "#ccccccff"
                    }
                },
                {
                    "featureType": "local",
                    "elementType": "labels.text.fill",
                    "stylers": {
                        "color": "#eeeeeeff"
                    }
                },
                {
                    "featureType": "local",
                    "elementType": "labels.text.stroke",
                    "stylers": {
                        "color": "#d6e4e5"
                    }
                },
                {
                    "featureType": "arterial",
                    "elementType": "labels.text.fill",
                    "stylers": {
                        "color": "#374a46"
                    }
                },
                {
                    "featureType": "highway",
                    "elementType": "labels.text.fill",
                    "stylers": {
                        "color": "#374a46"
                    }
                },
                {
                    "featureType": "water",
                    "elementType": "geometry.fill",
                    "stylers": {
                        "color": "#96b5d6"
                    }
                },
                {
                    "featureType": "boundary",
                    "elementType": "geometry",
                    "stylers": {
                        "color": "#0c343dff"
                    }
                },
                {
                    "featureType": "highway",
                    "elementType": "geometry.stroke",
                    "stylers": {
                        "color": "#e4f2f6ff"
                    }
                }

        ]
    });

    var taskMap = [];
    var carMap = [];
    var roomMap=[];

    var myIconD = new BMap.Icon('/img/map/d24.gif',new BMap.Size(24,24));
    var myIconP = new BMap.Icon('/img/map/p24.gif',new BMap.Size(24,24));

    var myIcon10 = new BMap.Icon('/img/map/w18.gif',new BMap.Size(18,18));
    var myIcon20 = new BMap.Icon('/img/map/g32.gif',new BMap.Size(32,32));
    var myIcon30 = new BMap.Icon('/img/map/x32.gif',new BMap.Size(32,32));
    var myIcon40 = new BMap.Icon('/img/map/q32.gif',new BMap.Size(32,32));
    var myIcon50 = new BMap.Icon('/img/map/x32.gif',new BMap.Size(32,32));
    var myIcon60 = new BMap.Icon('/img/map/c32.gif',new BMap.Size(32,32));
    var myIcon70 = new BMap.Icon('/img/map/k32.gif',new BMap.Size(32,32));
    var myIcon80 = new BMap.Icon('/img/map/q32.gif',new BMap.Size(32,32));
    var myIcon90 = new BMap.Icon('/img/map/x32.gif',new BMap.Size(32,32));

    var carIcon = new BMap.Icon('/img/map/car.png',new BMap.Size(80,56));
    map.setCurrentCity("泰州");          // 设置地图显示的城市 此项是必须设置的
    map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放
    //-----------------------------------------------------------------------------------
    //基础信息
    //-----------------------------------------------------------------------------------
    $.get("/boardroom/allList",function (data) {
        for(var i=0;i<data.result.length;i++){
            var marker;
            var pointm = new BMap.Point(data.result[i].boardlng, data.result[i].boardlat);
            var content = "<ul id='navv'><li class='a'>项目编号："
                    +data.result[i].projectcode
                    +"</li><li class='b'>巡检单位："
                    +data.result[i].routername
                    +"</li><li class='c'>巡检日期："
                    +data.result[i].checktime
                    +"</li><li class='d'>负责人："
                    +data.result[i].factoryuser
                    +"</li><li class='e'>联系方式："
                    +data.result[i].factoryphone+"</li></ul>";
            var title = data.result[i].boardname;
            var opts = {
                width : 260,     // 信息窗口宽度
                height: 180,     // 信息窗口高度
                title : title , // 信息窗口标题
                enableMessage:true//设置允许信息窗发送短息
            };
            var label = new BMap.Label(title, {position:pointm,offset:new BMap.Size(16,32)});
            label.setStyle({transform: 'translateX(-50%)'});
            if(data.result[i].voltmark=='10kV') {
                marker = new BMap.Marker(pointm, {icon: myIconP,offset:new BMap.Size(0,0)});  // 创建标注
            }else{
                marker = new BMap.Marker(pointm, {icon: myIconD,offset:new BMap.Size(0,0)});  // 创建标注
            }
            marker.setLabel(label);
            map.addOverlay(marker);               // 将标注添加到地图中
            addClickHandler(content,marker,opts);
            var boardroom = {marker:marker,label:label};
            roomMap.push(boardroom);
        }
    });

    //-----------------------------------------------------------------------------------
    //任务信息--定时任务
    //-----------------------------------------------------------------------------------
    $.get("/task/allTask",function (data) {
        //删除点
        taskMap.forEach(function(value,i){
            map.removeOverlay(value);
        });
        taskMap = [];
        for(var i=0;i<data.result.length;i++){
            var marker;
            var pointm = new BMap.Point(data.result[i].boardlng, data.result[i].boardlat);
            var content = "<ul id='czd'><li class='a'>项目编号："
                    +data.result[i].projectcode
                    +"</li><li class='b'>巡检单位："
                    +data.result[i].routername
                    +"</li><li class='c'>派单时间："
                    +data.result[i].createtime
                    +"</li><li class='f'>接单时间："
                    +data.result[i].gettime
                    +"</li><li class='d'>负责人："
                    +data.result[i].factoryuser
                    +"</li><li class='e'>联系方式："
                    +data.result[i].factoryphone+"</li></ul>";
            var title = data.result[i].boardname;
            var opts = {
                width : 260,     // 信息窗口宽度
                height: 220,     // 信息窗口高度
                title : title , // 信息窗口标题
                enableMessage:true//设置允许信息窗发送短息
            };
            //var label = new BMap.Label(title, {position:pointm,offset:new BMap.Size(16,32)});
            //label.setStyle({transform: 'translateX(-50%)'});
            if(data.result[i].tasktype==10) {
                marker = new BMap.Marker(pointm, {icon: myIcon10,offset:new BMap.Size(0,0)});  // 创建标注
            }else if(data.result[i].tasktype==20){
                marker = new BMap.Marker(pointm, {icon: myIcon20,offset:new BMap.Size(0,0)});  // 创建标注
            }else if(data.result[i].tasktype==30){
                marker = new BMap.Marker(pointm, {icon: myIcon30,offset:new BMap.Size(0,0)});  // 创建标注
            }else if(data.result[i].tasktype==40){
                marker = new BMap.Marker(pointm, {icon: myIcon40,offset:new BMap.Size(0,0)});  // 创建标注
            }else if(data.result[i].tasktype==50){
                marker = new BMap.Marker(pointm, {icon: myIcon50,offset:new BMap.Size(0,0)});  // 创建标注
            }else if(data.result[i].tasktype==60){
                marker = new BMap.Marker(pointm, {icon: myIcon60,offset:new BMap.Size(0,0)});  // 创建标注
            }else if(data.result[i].tasktype==70){
                marker = new BMap.Marker(pointm, {icon: myIcon70,offset:new BMap.Size(0,0)});  // 创建标注
            }else if(data.result[i].tasktype==80){
                marker = new BMap.Marker(pointm, {icon: myIcon80,offset:new BMap.Size(0,0)});  // 创建标注
            }else if(data.result[i].tasktype==90){
                marker = new BMap.Marker(pointm, {icon: myIcon90,offset:new BMap.Size(0,0)});  // 创建标注
            }
            //marker.setLabel(label);
            map.addOverlay(marker);               // 将标注添加到地图中
            addClickHandler(content,marker,opts);
            taskMap.push(marker);
        }
    });

    //-----------------------------------------------------------------------------------
    //执行任务人员位置
    //-----------------------------------------------------------------------------------
    $.get("/cunsumer/pos/all",function (data) {
        //删除点
        carMap.forEach(function(value,i){
            map.removeOverlay(value.mark);
            map.removeOverlay(value.label);
        });
        carMap = [];
        for(var i=0;i<data.result.length;i++){
            var marker;
            var pointm = new BMap.Point(data.result[i].cunsumerlng, data.result[i].cunsumerlat);
            var content = "<ul id='czd'><li class='a'>人员编号："
                    +data.result[i].cunsumerid
                    +"</li><li class='b'>人员名称："
                    +data.result[i].cunsumername
                    +"</li><li class='c'>手机号码："
                    +data.result[i].cunsumerphone
                    +"</li><li class='d'>巡检单位："
                    +data.result[i].routername
                    +"</li><li class='f'>更新时间："
                    +data.result[i].uptime
                    +"</li></ul>";
            var opts = {
                width : 260,     // 信息窗口宽度
                height: 180,     // 信息窗口高度
                title : data.result[i].cunsumername , // 信息窗口标题
                enableMessage:true//设置允许信息窗发送短息
            };
            var label = new BMap.Label(data.result[i].cunsumername, {position:pointm,offset:new BMap.Size(40,44)});
            label.setStyle({transform: 'translateX(-50%)'});

            marker = new BMap.Marker(pointm, {icon: carIcon,offset:new BMap.Size(0,0)});  // 创建标注

            marker.setLabel(label);
            map.addOverlay(marker);               // 将标注添加到地图中
            addClickHandler(content,marker,opts);
            var carinfo =  {mark:marker,label:label};
            carMap.push(carinfo);
        }
    });

    var ref = setInterval(function() {
        //-----------------------------------------------------------------------------------
        //任务信息--定时任务
        //-----------------------------------------------------------------------------------
        $.get("/task/allTask", function (data) {
            //删除点
            taskMap.forEach(function (value, i) {
                map.removeOverlay(value);
            });
            taskMap = [];
            for (var i = 0; i < data.result.length; i++) {
                var marker;
                var pointm = new BMap.Point(data.result[i].boardlng, data.result[i].boardlat);
                var content = "<ul id='czd'><li class='a'>项目编号："
                        + data.result[i].projectcode
                        + "</li><li class='b'>巡检单位："
                        + data.result[i].routername
                        + "</li><li class='c'>派单时间："
                        + data.result[i].createtime
                        + "</li><li class='f'>接单时间："
                        + data.result[i].gettime
                        + "</li><li class='d'>负责人："
                        + data.result[i].factoryuser
                        + "</li><li class='e'>联系方式："
                        + data.result[i].factoryphone + "</li></ul>";
                var title = data.result[i].boardname;
                var opts = {
                    width: 260,     // 信息窗口宽度
                    height: 220,     // 信息窗口高度
                    title: title, // 信息窗口标题
                    enableMessage: true//设置允许信息窗发送短息
                };
                //var label = new BMap.Label(title, {position:pointm,offset:new BMap.Size(16,32)});
                //label.setStyle({transform: 'translateX(-50%)'});
                if (data.result[i].tasktype == 10) {
                    marker = new BMap.Marker(pointm, {icon: myIcon10, offset: new BMap.Size(0, 0)});  // 创建标注
                } else if (data.result[i].tasktype == 20) {
                    marker = new BMap.Marker(pointm, {icon: myIcon20, offset: new BMap.Size(0, 0)});  // 创建标注
                } else if (data.result[i].tasktype == 30) {
                    marker = new BMap.Marker(pointm, {icon: myIcon30, offset: new BMap.Size(0, 0)});  // 创建标注
                } else if (data.result[i].tasktype == 40) {
                    marker = new BMap.Marker(pointm, {icon: myIcon40, offset: new BMap.Size(0, 0)});  // 创建标注
                } else if (data.result[i].tasktype == 50) {
                    marker = new BMap.Marker(pointm, {icon: myIcon50, offset: new BMap.Size(0, 0)});  // 创建标注
                } else if (data.result[i].tasktype == 60) {
                    marker = new BMap.Marker(pointm, {icon: myIcon60, offset: new BMap.Size(0, 0)});  // 创建标注
                } else if (data.result[i].tasktype == 70) {
                    marker = new BMap.Marker(pointm, {icon: myIcon70, offset: new BMap.Size(0, 0)});  // 创建标注
                } else if (data.result[i].tasktype == 80) {
                    marker = new BMap.Marker(pointm, {icon: myIcon80, offset: new BMap.Size(0, 0)});  // 创建标注
                } else if (data.result[i].tasktype == 90) {
                    marker = new BMap.Marker(pointm, {icon: myIcon90, offset: new BMap.Size(0, 0)});  // 创建标注
                }
                //marker.setLabel(label);
                map.addOverlay(marker);               // 将标注添加到地图中
                addClickHandler(content, marker, opts);
                taskMap.push(marker);
            }
        });
    }, 20000);
    var ref = setInterval(function() {
        //-----------------------------------------------------------------------------------
        //执行任务人员位置
        //-----------------------------------------------------------------------------------
        $.get("/cunsumer/pos/all",function (data) {
            //删除点
            carMap.forEach(function(value,i){
                map.removeOverlay(value.mark);
                map.removeOverlay(value.label);
            });
            carMap = [];
            for(var i=0;i<data.result.length;i++){
                var marker;
                var pointm = new BMap.Point(data.result[i].cunsumerlng, data.result[i].cunsumerlat);
                var content = "<ul id='czd'><li class='a'>人员编号："
                        +data.result[i].cunsumerid
                        +"</li><li class='b'>人员名称："
                        +data.result[i].cunsumername
                        +"</li><li class='c'>手机号码："
                        +data.result[i].cunsumerphone
                        +"</li><li class='d'>巡检单位："
                        +data.result[i].routername
                        +"</li><li class='f'>更新时间："
                        +data.result[i].uptime
                        +"</li></ul>";
                var opts = {
                    width : 260,     // 信息窗口宽度
                    height: 180,     // 信息窗口高度
                    title : data.result[i].cunsumername , // 信息窗口标题
                    enableMessage:true//设置允许信息窗发送短息
                };
                var label = new BMap.Label(data.result[i].cunsumername, {position:pointm,offset:new BMap.Size(40,44)});
                label.setStyle({transform: 'translateX(-50%)'});

                marker = new BMap.Marker(pointm, {icon: carIcon,offset:new BMap.Size(0,0)});  // 创建标注

                marker.setLabel(label);
                map.addOverlay(marker);               // 将标注添加到地图中
                addClickHandler(content,marker,opts);
                var carinfo =  {mark:marker,label:label};
                carMap.push(carinfo);
            }
        });
    },30000);

    function addClickHandler(content,marker,opts){
        marker.addEventListener("click",function(e){
            openInfo(content,e,opts)}
        );
    }

    function openInfo(content,e,opts){
        var p = e.target;
        var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
        var infoWindow = new BMap.InfoWindow(content,opts);  // 创建信息窗口对象
        map.openInfoWindow(infoWindow,point); //开启信息窗口
    }

    // 定义一个控件类,即function
    function ShowHideControl(){
        // 默认停靠位置和偏移量
        this.defaultAnchor = BMAP_ANCHOR_BOTTOM_RIGHT;
        this.defaultOffset = new BMap.Size(10, 10);
    }

    // 通过JavaScript的prototype属性继承于BMap.Control
    ShowHideControl.prototype = new BMap.Control();

    // 自定义控件必须实现自己的initialize方法,并且将控件的DOM元素返回
    // 在本方法中创建个div元素作为控件的容器,并将其添加到地图容器中
    ShowHideControl.prototype.initialize = function(map){
        // 创建一个DOM元素
        var div = document.createElement("div");
        // 添加文字说明
        div.appendChild(document.createTextNode("隐藏配电站"));
        // 设置样式
        div.style.cursor = "pointer";
        div.style.border = "1px solid gray";
        div.style.backgroundColor = "white";
        // 绑定事件,点击一次放大两级
        div.onclick = function(e){
            if(div.firstChild.nodeValue=='隐藏配电站') {
                //删除点
                roomMap.forEach(function (value, i) {
                    map.removeOverlay(value.marker);
                    map.removeOverlay(value.label);
                });
                roomMap = [];
                div.firstChild.nodeValue = "显示配电站";
            }else{
                $.get("/boardroom/allList",function (data) {
                    for(var i=0;i<data.result.length;i++){
                        var marker;
                        var pointm = new BMap.Point(data.result[i].boardlng, data.result[i].boardlat);
                        var content = "<ul id='navv'><li class='a'>项目编号："
                                +data.result[i].projectcode
                                +"</li><li class='b'>巡检单位："
                                +data.result[i].routername
                                +"</li><li class='c'>巡检日期："
                                +data.result[i].checktime
                                +"</li><li class='d'>负责人："
                                +data.result[i].factoryuser
                                +"</li><li class='e'>联系方式："
                                +data.result[i].factoryphone+"</li></ul>";
                        var title = data.result[i].boardname;
                        var opts = {
                            width : 260,     // 信息窗口宽度
                            height: 180,     // 信息窗口高度
                            title : title , // 信息窗口标题
                            enableMessage:true//设置允许信息窗发送短息
                        };
                        var label = new BMap.Label(title, {position:pointm,offset:new BMap.Size(16,32)});
                        label.setStyle({transform: 'translateX(-50%)'});
                        if(data.result[i].voltmark=='10kV') {
                            marker = new BMap.Marker(pointm, {icon: myIconP,offset:new BMap.Size(0,0)});  // 创建标注
                        }else{
                            marker = new BMap.Marker(pointm, {icon: myIconD,offset:new BMap.Size(0,0)});  // 创建标注
                        }
                        marker.setLabel(label);
                        map.addOverlay(marker);               // 将标注添加到地图中
                        addClickHandler(content,marker,opts);
                        var boardroom = {marker:marker,label:label};
                        roomMap.push(boardroom);
                    }
                });
                div.firstChild.nodeValue = "隐藏配电站";
            }
        }
        // 添加DOM元素到地图中
        map.getContainer().appendChild(div);
        // 将DOM元素返回
        return div;
    }
    // 创建控件
    var myCtrl = new ShowHideControl();
    // 添加到地图当中
    map.addControl(myCtrl);

</script>